#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int n = 0, a[10][10] = { 0 }, i = 0, j = 0, k = 0,y=0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
        {
            scanf("%d", &a[i][j]);
        }
    }
    for (i = 0; i < n; i++)
    {
        int max = a[i][0];
        for (j = 0; j < n; j++)
        {
            if (max < a[i][j])
            {
                max = a[i][j];
            }
            for (k = 0; k < n; k++)
            {
                if (max < a[i][j])
                    break;
            }
            if (k == n)
            {
                a[i][y] = max;
            }
        }
    }
    printf("%d %d", i, y);

    return 0;
}